const { mongo } = require('mongoose')
const mongoose  = require('./db')

const goodsSchema = new mongoose.Schema({//商品表
    goodsName : String,//商品名称
    goodsId : String,//商品编号
    goodsDescribe : String,//商品描述
    goodsImg : String,//商品图片
    goodsKuCount : String,//商品库存
    goodsPrice : String,//商品价格
    goodsXiaoCount : String,//商品销量
    // 连接类型表
    categroyId:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'category'
    }
})

const goods = mongoose.model('goods',goodsSchema)

const categorySchema = new mongoose.Schema({//分类表
    cname : String,//分类名称    
})

const category = mongoose.model('category',categorySchema)

module.exports = {
    goods,
    category
}